﻿$(document).ready(function() {
// Active Navigation
// $(function(){
//   var path = location.pathname.substring(1);
//   if ( path )
//     $('.dc-mega a[href$="' + path + '"]').addClass('class', 'selected');
// });

	// Portfolio Wrappers
		$(".PortfolioItem").closest("ul").addClass("portfolio-list");
		$("#portFilter").closest("ul").addClass("portfolio-filter");
		$(".portfolio-list li.dfwp-item").remove();
		
		$('.portfolio-list').filterable();
		
		$(".portfolio-list").css('display', 'block');
		$(".portfolio-filter").css('display', 'block');
	
});

$(document).ready(function() {
// Create Ticket Form Error Display
    //$(".ErrorMessage #spanErrorLabel:not(:empty)").show();
    var str = $(".ErrorMessage #spanErrorLabel").text();
       if ($(".ErrorMessage #spanErrorLabel").text().length > 0) {

           $(".ErrorMessage #spanErrorLabel").show();
       }
       else {
           $(".ErrorMessage #spanErrorLabel").hide();
       }

// Date Inputs
	$("input[id $= 'DateTimeFieldDate']")
		.datepicker ({
			changeMonth: true,
			changeYear: true
		})
		
		$(".ms-dtinput input")
		.datepicker ({
			changeMonth: true,
			changeYear: true,
			dateFormat:"dd/mm/yy"
		})

	$("a[onclick ^= 'clickDatePicker']")
		.remove();
		
});


// Buttons
$(document).ready(function() {
	$(".nextTab a").button();
	$(".prevTab a").button();
    $("#refreshButton").button();

    //Navigator
    $(".childrenNode").click(function () {
          $(this).toggleClass("minusSign");
          });
});

<!--//--><![CDATA[//><!--
	$(function() {
	    // --- first section initially expanded:
	    //$("h2.expand").toggler({initShow: "div.collapse:first"});
	    // --- Other options:
	    //$("h2.expand").toggler({method: "toggle", speed: 0});
	    //$("h2.expand").toggler({method: "toggle"});
	    $("span.expand").toggler({speed: 500});
	    //$("h2.expand").toggler({method: "fadeToggle"});
	    //$("h2.expand").toggler({method: "slideFadeToggle"});    
	    $("#content").expandAll({trigger: "h2.expand", ref: "div.demo",  speed: 300, 
oneSwitch: false});
	});
	//--><!]]>
	
	
$(document).ready(function() {	
	//  CREATE TICKETS TOOLTIPS
	// select all desired input fields and attach tooltips to them
      try {
          $("#TicketMainContainer :input[title]").tooltip({

          // place tooltip on the right edge
          position: "center right",

          // a little tweaking of the position
          offset: [-2, 10],

          // use the built-in fadeIn/fadeOut effect
          effect: "fade",

          // custom opacity setting
          opacity: 0.7

          });
      } catch(err){
        return false;
        }

	// Article Tabs
	$("#articleTabs").tabs();

});


	
$(document).ready(function() {	
	//  CREATE TOOLTIPS For All other forms
	// select all desired input fields and attach tooltips to them
      try {
          $("#formContainer :input[title]").tooltip({

          // place tooltip on the right edge
          position: "bottom center",

          // a little tweaking of the position
          //offset: [-2, 10],

          // use the built-in fadeIn/fadeOut effect
          effect: "fade",

          // custom opacity setting
          opacity: 0.7

          });
      } catch(err){
        return false;
        }


});

$(document).ready(function() {	
// For Grouped Rollup web part
    $(".groupSubContainer .rollupSubHeading").nextUntil(".groupSubContainer1").hide();


 //$(".groupSubContainer").children().hide();

    $(".groupSubContainer .rollupSubHeading").click(function() {
        //$(this).nextUntil(".groupSubContainer").toggle();
   $(this).nextUntil(".groupSubContainer11").toggle();
        $(this).toggleClass("itemExpand");
    });

 $(".groupSubContainer .tempAA").click(function() { 
$(this).children().filter(":not(.rollupSubHeading)").show();
        $(this).nextUntil(".groupSubContainer").toggle();
        $(this).toggleClass("itemExpand");
    });


});



// For Scheduling Date  fORMAT//

 

        $(function(){

            $('.displayScheduleDate').each(function(i, obj) {
	if(obj != null)

{





            var dt=$.trim(obj.innerHTML.replace(' 00:00',''));
//dt=dt.trim(dt);

if(dt != '&nbsp;' )
{
if(dt != '' && dt.indexOf("formfield") < 1)
{

            var dts_=dt.split('/') ;      
            //alert($.datepicker.formatDate('dd M yy',new Date(dts_[2],dts_[1]-1,dts_[0])));
           obj.innerHTML=$.datepicker.formatDate('dd M yy',new Date(dts_[2],dts_[1]-1,dts_
[0]));
}
}
}
                });
        });
		
		
		

		function ShowModalDialog
(title,width,height,showClose,showMaximized,dialogReturnValueCallback )
		{
		//Using a generic object.
			var options = {
			
title:title,width:width,height:height,showClose:showClose,showMaximized:showMaximized,
			dialogReturnValueCallback:onClose
				 };
			SP.UI.ModalDialog.showModalDialog(options);
		}
		
		function onClose(dialogResult, returnValue) {
    SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
    //window.location.href.reload(true);
}
		
		function closeModalDialog() {



        this.curDialog.close(SP.UI.DialogResult.OK);  
SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, "close");
		

	
	var statusId = SP.UI.Status.addStatus("You have successfully approved the task");
SP.UI.Status.setStatusPriColor(statusId, 'yellow');


}

var curDialog;
		function WaitScreen() {  
  
    //if (SP.ScriptUtility.isNullOrUndefined(spUiDialogLoaded))  
      //  return;  
  
    this.curDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose('Operation in progress...', 
	'Please wait........', 100, 250);  
  
    
  
}

function CloseDialog() {  
      SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, "close");
     
  
}  
		